<?php
/**
 * 用于获取树结构数据
 * 
 * @author gao
 */
class CategoryModel
{
	//private $_table = 'st_goods_category';
	//private $_left = 'cat_left';
	//private $_right = 'cat_right';
	//private $_pk = 'id';
	
	private static $_treePlugin;
	
	public function __construct($table, $left, $right, $pk)
	{
		self::$_treePlugin = new Custom_Controller_Plugin_Tree(
			$table,
			$left,
			$right,
			$pk
		);
	}
	
	public function getTreeArray($textfield, $id = null)
	{
		return self::$_treePlugin->getTreeArray($textfield, $id);
	}
	
	public function getTreeList($textfield, $id = null)
	{
		return self::$_treePlugin->getTreeList($textfield, $id);
	}
	
	public function addTree(array $data = array())
	{
		return self::$_treePlugin->addTree($data['id'], $data);
	}
	
	public function deleteTree($id)
	{
		return self::$_treePlugin->deleteTree($id);
	}
	
	public function test($id)
	{
		return self::$_treePlugin->getParentNode($id);
	}
}